
#include "StdAfx.h"

#include "MyFixes.h"

BOOL ChangeSubWindowSizeX(HWND hwnd, int xSize, HWND hParent)
  {
    RECT rect;
    ::GetWindowRect(hwnd, &rect);
    POINT p1;
    p1.x = rect.left;
    p1.y = rect.top;
    ScreenToClient(hParent, &p1);
    return ::MoveWindow(hwnd, p1.x, p1.y, xSize, rect.bottom - rect.top, TRUE);
  }

bool IsDialogSizeOK(int xSize, int ySize)
{
  // it returns for system font. Real font uses another values
  LONG v = GetDialogBaseUnits();
  int x = LOWORD(v);
  int y = HIWORD(v);

  RECT rect;
  ::SystemParametersInfo(SPI_GETWORKAREA, NULL, &rect, NULL);
  
  int wx = rect.right - rect.left;
  int wy = rect.bottom - rect.top;
  return
    xSize / 4 * x <= wx &&
    ySize / 8 * y <= wy;
}